<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>一个案例</title>
    <style>
        .active {
            color:red;
        }
    </style>
</head>

<body>
    <script src="/js/vue.js"></script>
    <div id="app">
        <ul>
        <li :class="{active:currentInex === index}" v-for="(book,index) in book" @click="btnClick(index)">{{index}}-{{book}}</li>
        </ul>
    </div>

    <script>
        let app = new Vue({
            el: "#app",
            date: {
                books:["哈利波特","黑森林","十宗罪","钢铁是怎样炼成的"
                ],
                currentInex:''
            },
            methods: {
                btnClick() {
                    Vue.set(this.name, 0, "Shane")
                }
            }
        })
    </script>
</body>

</html>